package com.ruoyi.web.controller.teaching;


import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.teaching.domain.PlatformEEvent;
import com.ruoyi.teaching.domain.PlatformEEventResult;
import com.ruoyi.teaching.service.PlatformEEventResultService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 王旭
 * @since 2025-03-04
 */
@RestController
@RequestMapping("/platform/eventResult")
@Api(tags = "platform-赛事结果管理")
public class PlatformEEventResultController {
    @Autowired
    private PlatformEEventResultService platformEEventResultService;

    /**
     * 发布公示
     */
    @PostMapping("/addEventResult")
    @ApiOperation(value = "发布公示", notes = "发布公示")
    @Log(title = "【发布公示】", businessType = BusinessType.INSERT)
    public AjaxResult addEventResult(@RequestBody PlatformEEventResult eventResult) {
        return platformEEventResultService.addEventResult(eventResult);
    }

    /**
     * 删除公示
     */
    @DeleteMapping("/deleteEventResult")
    @ApiOperation(value = "删除公示", notes = "删除公示")
    @Log(title = "【删除公示】", businessType = BusinessType.DELETE)
    public AjaxResult deleteEventResult(Long[] ids) {
        return platformEEventResultService.deleteEventResultByIds(ids);
    }

    /**
     * 后台查询赛事结果
     */
    @GetMapping("/listEventResult")
    @ApiOperation(value = "后台查询赛事结果", notes = "后台查询赛事结果")
    public AjaxResult listEventResult(Integer pageNum,Integer pageSize,String eventName,Integer eventLevel,Integer professionalCategoryId) {
        return platformEEventResultService.selectListEventResult(pageNum, pageSize, eventName, eventLevel, professionalCategoryId);
    }

    /**
     * 增加浏览量
     */
    @PostMapping("/addViewCount")
    @ApiOperation(value = "增加浏览量", notes = "增加浏览量")
    public AjaxResult addViewCount(Long id) {
        return platformEEventResultService.addViewCount(id);
    }

    /**
     * 根据id查询详情
     */
    @GetMapping("/{id}")
    @ApiOperation(value = "根据id查询详情", notes = "根据id查询详情")
    public AjaxResult getResultById(@PathVariable Long id) {
        return platformEEventResultService.getResultById(id);
    }
}

